#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
struct Node {
  int val, ch[2];
} tr[265];
int tot;
void init() {
  tot = 0;
  memset(tr, 0, sizeof(tr));
}
bool update(string s, int val) {
  int p = 0;
  for (char c : s) {
    int x = c == 'R';
    if (!tr[p].ch[x]) tr[p].ch[x] = ++tot;
    p = tr[p].ch[x];
  }
  if (tr[p].val) return false;
  tr[p].val = val;
  return true;
}
bool build_tree(vector<string>& nodes) {
  int val;
  string tmp;
  for (string s : nodes) {
    int mid = s.find(',');
    tmp = s.substr(1, mid - 1);
    val = stoi(tmp);
    tmp = s.substr(mid + 1, s.size() - mid - 2);
    if (!update(tmp, val)) return false;
  }
  return nodes.size() == tot + 1;
}
void bfs() {
  queue<int> q;
  vector<int> res;
  q.push(0);
  while (q.size()) {
    int p = q.front();
    q.pop();
    res.push_back(tr[p].val);
    if (tr[p].ch[0]) q.push(tr[p].ch[0]);
    if (tr[p].ch[1]) q.push(tr[p].ch[1]);
  }
  rep(i, 0, res.size() - 1) { cout << res[i] << " \n"[i == res.size() - 1]; }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  string s;
  while (cin >> s) {
    init();
    vector<string> nodes;
    while (s != "()") {
      nodes.push_back(s);
      cin >> s;
    }
    bool res = build_tree(nodes);
    if (!res)
      cout << "not complete" << endl;
    else
      bfs();
  }
  return 0;
}